# Load libraries
library(terra)
library(viridis)
library(rnaturalearth)
# Query DEM data for Colombia
col_dem <- geodata::elevation_30s(country = "COL", path = tempdir())
# Query boundary of Colombia
col <- ne_countries(scale = 10, country = "Colombia")
# Plot the map to a png file
png("slides/figures/colombia-dem.png", bg = "transparent", height = 4,
width = 4, res = 300, units = "in")
par(mar = c(0, 0, 0, 0))
plot(ext(col_dem), lty = 0, axes = FALSE)
plot(col$geometry, add = TRUE, border = "#f1faee", axes = FALSE, box = FALSE)
plot(col_dem, col = magma(100), add = TRUE, axes = FALSE, box = FALSE,
legend = "bottom",
plg = list(title = "Elevation (m)", cex = 0.7, col = "white", lwd = 2,
title.col = "white", title.cex = 0.7))
dev.off()